feat(cli): add me import granola for meeting notes & transcripts#91
Open
murrayju wants to merge 2 commits into
Open
feat(cli): add me import granola for meeting notes & transcripts#91murrayju wants to merge 2 commits into
me import granola for meeting notes & transcripts#91murrayju wants to merge 2 commits into
Conversation
Import Granola meetings (AI summary notes + transcripts) into the memory engine, one memory per meeting. Reuses the Granola desktop app's existing session: reads its locally-stored, safeStorage-encrypted WorkOS tokens (decrypted via the macOS login keychain), refreshes the access token, and pulls meetings from the Granola API. - Idempotent on (tree, document_id) via content-aware `replace`; re-imports reconcile in place, never duplicate. - One self-contained Markdown memory per meeting: title, date/attendees, notes, and (default-on) speaker-grouped transcript. - Adds a generic `meta.display_name` presentation hint the web tree prefers over `name`/content, so Granola leaves show "Title — date" instead of the document-id `name` that keys idempotency. macOS-only for now (credential read uses the login keychain).
7337686 to
6f403bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
me import granola— import Granola meetings (AI summary notes + transcripts) into the memory engine, one memory per meeting.There is no separate Granola login. The importer reuses the Granola desktop app's existing session by reading its locally-stored,
safeStorage-encrypted WorkOS tokens (decrypting them via the macOS login keychain), refreshing the short-lived access token through Granola's API, then pulling meetings.How it works
auth.ts) — reproduces Granola's two-layer ElectronsafeStoragescheme entirely from local material: keychain password → PBKDF2 → AES-128-CBC decrypt ofstorage.dek→ 32-byte data key → AES-256-GCM decrypt ofsupabase.json.enc. Throws actionable errors when Granola isn't installed/signed in, on non-macOS, or if the format changes.client.ts) — refreshes the access token (/v1/refresh-access-token), then pulls meetings (/v2/get-documents, offset-paged), AI summary panels (/v1/get-document-panels), and transcripts (/v1/get-document-transcript). Sends the requiredX-Client-Versionheader.render.ts) — one self-contained Markdown memory per meeting: title heading, date/attendees line, AI notes, and (default-on) the transcript grouped into speaker turns (Me= your mic,Them= everyone else; Granola doesn't attribute remote speakers). Notes prefer the meeting's ownnotes_markdown, then a panel's structured ProseMirror content (keeps nested-list indentation), then its HTML.index.ts) — lists meetings, pre-filters (deleted / invalid / since / until / empty), fetches notes+transcript per meeting, submits viabatchCreatewithonConflict: "replace".Idempotency
Keyed on
(tree, name)wherenameis the Granoladocument_id. Re-imports reconcile in place via the server's content-awarereplace(stampedmeta.importer_version): an unchanged meeting is a no-op, a changed one is rewritten, nothing is duplicated.meta.display_name(web tree labels)Because the leaf
nameis the document UUID (to key idempotency), the web tree would otherwise show a UUID. This PR adds a genericmeta.display_namepresentation hint: the web tree'smemoryToLeafnow prefersmeta.display_name→name→ first content line → id tail. The Granola importer stamps"Title — YYYY-MM-DD", so a recurring meeting title stays distinguishable by date. This is not Granola-specific — any memory can set it.Tree layout
Tests
auth.test.ts— synthesizes thestorage.dek+supabase.json.encpair in reverse from a known password and asserts the decrypt chain recovers tokens; covers missing/corrupt material and the non-macOS guard.render.test.ts— HTML→MD and ProseMirror→MD conversion, notes-source precedence, transcript speaker grouping,display_nameformatting.index.test.ts— pre-filtering, per-meeting fetch gating, empty-meeting skip, dry-run, batch submission (fake source + in-memory engine; no network/DB).tree-build.test.ts—display_nameprecedence + blank/non-string guard.All suites green (
./bun run check: 671 pass). Verified end-to-end against real Granola data (311 meetings, 309 importable; idempotent re-import confirmed).Notes / limitations
MonacoMarkdownEditor.tsxare unrelated (already onmain;packages/webis excluded from the root typecheck).